package com.example.zluserservice.entity;

import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * @Author zhenliu（孙凌岳）
 * @Description AI根据设计的数据库表结构生成实体类
 * @Date 2025/6/14 12:06
 * @Version 1.0
 */
@Data
@NoArgsConstructor
@TableName("sys_user") // 实际路由后是 sys_user_0/1/2
@ApiModel(description = "系统用户类")
public class User implements Serializable {
    /**
     * 主键
     */
    private Long id;

    /**
     * 用户账号
     */
    private String username;

    /**
     * 密码
     */
    private String password;

    /**
     * 头像地址
     */
    private String avatar;

    /**
     * 用户昵称
     */
    private String nickName;

    /**
     * 用户邮箱
     */
    private String email;

    /**
     * 手机号码
     */
    private String mobile;

    /**
     * 用户性别（0男 1女 2未知）
     */
    private String sex;

    /**
     * 数据状态（0正常 1停用）
     */
    private String dataState;

    /**
     * 是否删除
     */
    @TableLogic
    private Integer isDelete;

    /**
     * 创建时间
     */
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(fill = FieldFill.INSERT)
    private LocalDateTime createTime;

    /**
     * 更新时间
     */
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updateTime;

    /**
     * 创建人
     */
    private Long createBy;

    /**
     * 更新人
     */
    private Long updateBy;

    /**
     * 备注
     */
    private String remark;

    @Builder
    public User(Long id, String username, String password, String avatar, String nickName, String email, String mobile, String sex, String dataState, Integer isDelete, LocalDateTime createTime, LocalDateTime updateTime, Long createBy, Long updateBy, String remark) {
        this.id = id;
        this.username = username;
        this.password = password;
        this.avatar = avatar;
        this.nickName = nickName;
        this.email = email;
        this.mobile = mobile;
        this.sex = sex;
        this.dataState = dataState;
        this.isDelete = isDelete;
        this.createTime = createTime;
        this.updateTime = updateTime;
        this.createBy = createBy;
        this.updateBy = updateBy;
        this.remark = remark;
    }
}